//
// Created by 束庆乐 on 2024/12/28.
//
#include "stdio.h"
#include "stdlib.h"
#include "string.h"

int main(){
    int* p = (int*) malloc(sizeof(int)*10);
    //重置内存空间的值为0（每个字节都是0），最主要还是重置0，重置其他的不适合
    memset(p,0,40);
    char ch[10];
    memset(ch,'a',sizeof(char)*10);
    printf("%s\n",ch);

    for (int i = 0; i < 10; ++i) {
        printf("%d\n",p[i]);
    }
    free(p);

    int arr[] = {1,2,3};
    int* myarr = (int*) malloc(sizeof(int)*3);
    memcpy(myarr,arr, sizeof(int)*3);
    for (int i = 0; i < 3; ++i) {
        printf("%d ",myarr[i]);
    }
    free(myarr);
    return 0;
}